Maalesef <uygulama_adi> durdu. ()
Android de konum bilgimi almak istiyorum fakat sürekli ' Maalesef <uygulama_adi> durdu ' hatası alıyorum.Emilatör olarak HTC One telefonumu kullanıyorum.Herşeyi tam yaptığımı sanıyorum yardımcı olurmusunuz. google_play_services-lib kütüphanesini projeye import ettim.
<LogCat>
09-16 23:32:27.828: W/asset(2482): Copying FileAsset 0x76646d90 (zip:/data/app/com.frknbrgl.nerdeyim-1.apk:/resources.arsc) to buffer size 142268 to make it aligned.
09-16 23:32:27.848: W/dalvikvm(2482): Link of class 'Lcom/frknbrgl/nerdeyim/MainActivity;' failed
09-16 23:32:27.848: W/dalvikvm(2482): threadid=1: thread exiting with uncaught exception (group=0x416c8e18)
09-16 23:32:27.848: E/AndroidRuntime(2482): FATAL EXCEPTION: main
09-16 23:32:27.848: E/AndroidRuntime(2482): Process: com.frknbrgl.nerdeyim, PID: 2482
09-16 23:32:27.848: E/AndroidRuntime(2482): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.frknbrgl.nerdeyim/com.frknbrgl.nerdeyim.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /vendor/lib, /system/lib]]
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2641)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread.access$800(ActivityThread.java:156)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.os.Handler.dispatchMessage(Handler.java:102)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.os.Looper.loop(Looper.java:157)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread.main(ActivityThread.java:5867)
09-16 23:32:27.848: E/AndroidRuntime(2482): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 23:32:27.848: E/AndroidRuntime(2482): at java.lang.reflect.Method.invoke(Method.java:515)
09-16 23:32:27.848: E/AndroidRuntime(2482): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
09-16 23:32:27.848: E/AndroidRuntime(2482): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
09-16 23:32:27.848: E/AndroidRuntime(2482): at dalvik.system.NativeStart.main(Native Method)
09-16 23:32:27.848: E/AndroidRuntime(2482): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /vendor/lib, /system/lib]]
09-16 23:32:27.848: E/AndroidRuntime(2482): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
09-16 23:32:27.848: E/AndroidRuntime(2482): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
09-16 23:32:27.848: E/AndroidRuntime(2482): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
09-16 23:32:27.848: E/AndroidRuntime(2482): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2494)
09-16 23:32:27.848: E/AndroidRuntime(2482): ... 11 more
09-16 23:32:31.252: D/Process(2482): killProcess, pid=2482
09-16 23:32:31.252: D/Process(2482): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException:136 java.lang.ThreadGroup.uncaughtException:693 java.lang.ThreadGroup.uncaughtException:690
<MainActivty.java>
package com.frknbrgl.nerdeyim;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener {
private LocationClient locationClient;
private LocationRequest locationRequest;
private TextView enlemTextView;
private TextView boylamTextView;
private TextView adresTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
enlemTextView = (TextView) findViewById(R.id.enlemTextView);
boylamTextView = (TextView) findViewById(R.id.boylamTextView);
adresTextView = (TextView) findViewById(R.id.adresTextView);
locationClient = new LocationClient(this, this, this);
locationRequest = LocationRequest.create()
.setInterval(0)
.setFastestInterval(0)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
@Override
public void onLocationChanged(Location location) {
enlemTextView.setText(String.valueOf(location.getLatitude()));
boylamTextView.setText(String.valueOf(location.getLongitude()));
GeocodingTask task = new GeocodingTask(MainActivity.this);
task.execute(new Location[] {location});
}
private class GeocodingTask extends AsyncTask<Location, Void, String> {
private Context context;
public GeocodingTask(Context context) {
super();
this.context = context;
}
@Override
protected String doInBackground(Location... params) {
Location location = params[0];
Geocoder geocoder = new Geocoder(context, new Locale("tr", "TR"));
try {
List<Address> adresListesi = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if(adresListesi != null && adresListesi.size() > 0) {
Address adres = adresListesi.get(0);
String adresSatiri = adres.getMaxAddressLineIndex() > 0 ? adres.getAddressLine(0) : "";
String postaKodu = adres.getPostalCode();
String ulke = adres.getCountryName();
String adresString = String.format("%s, %s, %s", adresSatiri, postaKodu, ulke);
return adresString;
}
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
@Override
protected void onPostExecute(String result) {
adresTextView.setText(result);
}
}
@Override
public void onConnected(Bundle connectionHint) {
locationClient.requestLocationUpdates(locationRequest, this);
}
@Override
public void onDisconnected() {}
@Override
public void onConnectionFailed(ConnectionResult result) {}
@Override
protected void onResume() {
super.onResume();
locationClient.connect();
}
@Override
public void onPause() {
super.onPause();
if(locationClient.isConnected())
locationClient.removeLocationUpdates(this);
locationClient.disconnect();
}
}
<AndroidManifest.xml>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.frknbrgl.nerdeyim"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>